#include "shm.hpp"
#include "fifo.hpp"

int main()
{
    //必须要先构建shm:
    //如果先构建fifo的话,在client启动前会堵塞在打开管道,那么有可能client会先创建共享内存
    Shm shm(pathName, projId, CREATER);
    NameFifo fifo(PATH, FILENAME);
    FileOper readFO(PATH, FILENAME);
    readFO.OpenForRead();
    char *mm = (char*)shm.VirtualAddr();
    while(1)
    {
        if(readFO.Wait())
        {
           cout << mm << endl; 
        }
        else
        {
            break;
        }
    }

    shm.Attr();

    return 0;
}